<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<style>
.red{ color:red;}
.admin_nrtop{ padding:20px; width:860px;}
.admin_nrtop a.way{ font-size:16px; padding:0px 15px;}
.admin_nrtop a.red{ color:red;}
.dqfc{ float:left;padding: 8px; border: 1px solid #d4dae2; margin-top:3px;}
.dqfc span{ padding-right:20px;}
.dqfc span.pr{ padding-right:160px;}
.dqfc span font{ color:red;}
.search{ float:right; margin-top:-5px; margin-right:10px;}
</style>
<div class="admin_nrtop">
<div class="ad_search">
	<a href="/admini/agent/waybill/status/1" class="way <?php if($this->status==1){ echo 'red';}?>">未完成运单</a><a href="/admini/agent/waybill/status/2" class="way <?php if($this->status==2){ echo 'red';}?>">已完成运单</a>
    <form action="/admini/agent/waybill/"  method="get" style=" display:inline;" id="form1">
        <span class="red" style="float:right; font-size:16px;">例如：2016-06</span>
        <div class="search">
            <div class="soubox">
                <input type="text" id="quick" name="quick" value="<?php echo $this->quick?$this->quick:"";?>" placeholder="请输入年月"/>
                <input type="hidden" id="status" name="status" value="<?php echo $this->status?$this->status:"";?>" />
            </div>
            <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
        </div>
        <span style="float:right; font-size:16px;">月度运单查询：</span>
    </form>
</div>
</div>

<div  class="biaoge">

	<div class="biaotbody">
        <table>
            <tr>
                <th class="li9">
                    <div class="lileft">悠奇运单编号</div>
                </th>
                <th class="li9">
                    运送方式
                </th>
                <th class="li9">
                    目的地
                </th>
                <th class="li7">
                    收件人
                </th>
                <th class="li7">
                    包裹重量
                </th>
                <th class="li7" style="display:none">
                    <div class="biaoxiala">
                        <div class="lixiala">
                            <span>预付重量(kg)</span>
                            <i></i>
                        </div>
                        <div class="biaofw" style="display:none;">
                            <input type="text" id="paymentstart" name="paymentstart" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
                                <span>至</span>
                                <input type="text" id="paymentend" name="paymentend" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
                                <a href="javascript:setpayment()">确定</a>
                        </div>
                    </div>
                </th>
                <th class="li10" >
					入库时间
                </th>
                <th class="li7">
					预付款(rmb)
                </th>
                <th class="li7" style=" display:none">
					结算金额
                </th>
                <th class="li7">
					最终收款
                </th>
                <th class="li7">
					状态
                </th>
            </tr>
        </table>
    </div>  
             
    <div class="table2">
        <?php 
            if($this->billlist){
                
            foreach ($this->billlist as $key => $Item) {?>
            <?php $billRemark = Application_Model_Remark::getObjectRemark($Item->id); ?>
        <div class="tablebox">
            <table>
                <tr class="trhui" style=" color:#888;">
                    <td colspan="10" class="td_<?php echo $Item->Id;?>">
                        <div class="yundangk">
                            <p><span class="lileft">提交：<?php echo $Item->dateCreated;?></span><span>付款：<?php echo $Item->datePaid;?></span>
                                <span class="lileft">仓库号：<?php echo $Item->user->storeno;?>
                                </span><span class="lileft">用户名：<?php echo $Item->user->nikename;?></span></p>
                        </div>
                    </td>
                </tr>
                
                <tr>
                    <td class="li9">
                        <div class="lileft"><?php echo $Item->billNo;?></div>
                    </td>
                    <td class="li9"><?php echo $Item->ExpressBy!=null?$Item->ExpressBy->name:"";?></td>
                    <td class="li9"><?php echo $Item->UserCity?$Item->UserCity->name:"";?></td>
                    <td class="li7"><?php echo $Item->consignee;?></td>
                    <td class="li7"><?php echo $Item->productWeight/1000;?></td>
                    <td class="li7" style="display:none"><?php if ($Item->ExpressBy->isVolume == 1) {
                            if ($Item->volumeWeight > ($Item->productWeight + $Item->bagWeight)) {
                                echo ($Item->volumeWeight / 1000)."kg(体积)" ;
                            } else {
                                echo (($Item->productWeight + $Item->bagWeight) / 1000)."kg(重量)" ;;
                            }
                        } else {
                            echo (($Item->productWeight + $Item->bagWeight) / 1000)."kg(重量)" ;;
                        }?></td>
                    <td class="li10"><?php echo $Item->stockDate;?></td>
                    <td class="li7"><?php echo $Item->getFeeByType(Application_Model_FeeType::EstimateSum);?></td>
                    <td class="li7" style=" display:none"><?php echo $Item->lastMoney;?></div></td>
                    <td class="li7">
					<?php 
						$bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');  
						$db = $bootstrap->getResource('db');
						$ot_fee = $db->fetchOne(
							 "SELECT sum(money) AS money FROM uuch_wayfee where feeType in (2,3,4,5,6,7,19,20,21) and wayId = $Item->id"
						 );	
						 if($Item->lastMoney){
						 	echo $ot_fee+$Item->lastMoney;		
						 }
					?>
                    
                    
                    </div></td>
                    <td class="li7"><?php echo ($Item->problem == Application_Model_wayBillItem::Problem_Cancel?"取消":$Item->interiorname);?></td>
                </tr>
            </table>
        </div>
        <?php } } else { echo '<div class="tablebox">暂时无数据</div>';}?>
    </div>
            
</div>
    
<div class="toolbar">
    <div class="dqfc">
        <span>时间：<font><?php echo date('Y-m',time());?></font></span>
        <span class="pr">当月客户发单：<font><?php echo $this->dq_nums ;?></font>个</span>
        <span>发单金额：<font><?php echo $this->dq_money;?></font>元</span>
        <span>可提成金额：<font>
        <?php   
			if($this->dq_money<200000){
				echo $this->dq_money*0.03;
			}else if($this->dq_money>=200000 && $this->dq_money<300000){
				echo $this->dq_money*0.04;
			}else if($this->dq_money>=300000 && $this->dq_money<400000){
				echo $this->dq_money*0.05;
			}else if($this->dq_money>=400000){
				echo $this->dq_money*0.06;
			}
        ?>
        </font>元</span>
        <span style="color:#888;">（此统计为已完成运单）</span>
    </div>
    <?php
    echo $this->partial('paging.phtml', array("pages" => $this->billall,"pamas"=>"status=$this->status&quick=$this->quick"));        
    ?>
    <div style="clear:both;"></div>
</div>
    
